
public class e036 {
    public static void main(String[] args) {
        long sTime = System.currentTimeMillis();
        int sum = 0;
        for (int i = 1; i < 1000000; i++) {
            String bin = Integer.toBinaryString(i);
            String ten = String.valueOf(i);
            StringBuilder binB = new StringBuilder(bin);
            StringBuilder tenB = new StringBuilder(ten);
            if (bin.equals(binB.reverse().toString()) && ten.equals(tenB.reverse().toString())){
                sum += i;
            }
        }
        System.out.println(sum);
        long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }
}